package com.heima.wemedia.feign;

import com.heima.feign.wemedia.IChannelClient;
import com.heima.model.channel.dtos.ChannelDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmchannelDto;
import com.heima.wemedia.service.WmchannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author rookie001
 * @creat 2023-06-20-9:48
 */
@RestController
public class WmChannelClient implements IChannelClient {
    @Autowired
    private WmchannelService wmchannelService;

    //频道名称模糊分页查询
    @PostMapping("/api/v1/channel/list")
    public ResponseResult list(@RequestBody ChannelDto dto) {
        return wmchannelService.listChannel(dto);
    }

    //频道新增
    @PostMapping("/api/v1/channel/save")
    public ResponseResult save(@RequestBody WmchannelDto dto) {
        return wmchannelService.saveCha(dto);
    }

    //频道修改
    @PostMapping("/api/v1/channel/update")
    public ResponseResult update(@RequestBody WmchannelDto dto) {
        return wmchannelService.updateCha(dto);
    }

    //频道删除
    @GetMapping("/api/v1/channel/del/(id)")
    public ResponseResult del(@RequestBody WmchannelDto dto) {
        return wmchannelService.delCha(dto);
    }
}
